﻿using System;
using System.Linq;

using Cookbook.Common;

using FluentAssertions;

namespace Cooking.Services.Specs.Support
{
    internal static class RuleViolationExtensions
    {
        public static void ShouldViolate(this Action action, Rule rule)
        {
            action
                .ShouldThrow<RuleViolationException>()
                .Where(e => e.Violations.Any(v => v.Rule == rule));
        }
    }
}
